package com.lsk.util;

import com.jfinal.json.Json;
import com.jfinal.kit.HttpKit;
import com.jfinal.weixin.sdk.utils.JsonUtils;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * 四川涪擎大数据技术有限公司 提供的接口
 *
 * 文档地址 https://market.aliyun.com/products/56928004/cmapi023201.html?spm=5176.730005.productlist.d_cmapi023201.58113524Mid4zv&innerSource=search_%E5%BF%AB%E9%80%92#sku=yuncode1720100000
 * 快递信息查询 工具类
 */
public class ExpressageUtil {

    private static String appKey="25495818";
    private static String appSecret="07a6c1586806537e1bf63d0902bf07d4";
    private static String appCode="1d4731d92f0f46269f292b27885eeae8";

    public static String getInfo(String orderNo){
        String result="";
        String url = "https://goexpress.market.alicloudapi.com/goexpress";

        Map<String, String> headers = new HashMap<String, String>();
        //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
        headers.put("Authorization", "APPCODE " + appCode);
        Map<String, String> querys = new HashMap<String, String>();
        querys.put("no", orderNo);
        //JDK 1.8示例代码请在这里下载：  http://code.fegine.com/Tools.zip

        try {
            result=HttpKit.get(url,querys,headers);
//            resultMap= JsonUtils.parse(result,Map.class);
           System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    public static void main(String[] strings){

        getInfo("75119937609755");

    }

}
